<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>upload模块快速使用</title>
    <link rel="stylesheet" href="./layui/css/layui.css" />
    <script src="./layui/jquery-1.11.2.min.js"></script>
    <script src="./layui/layui.js"></script>
</head>
<body>

<div class="layui-form-item">
    <label class="layui-form-label">Logo</label>
    <div class="layui-input-block">
        <img src="" id="logo" /><Br/>
        <input type="hidden" name="logo" value=""/>  <!--用于提交表单-->
        <button type="button" class="layui-btn" id="uploadlogo">
            <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
    </div>
</div>

<script>
    layui.use('upload', function(){
        var upload = layui.upload;
        $('#uploadlogo').click(function () {
            alert(123);
        })

        //执行实例
        var uploadInst = upload.render({
            elem: '#uploadlogo' //绑定元素
            ,url: '/upload/' //上传接口
            ,done: function(res){
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>
</body>
</html>